#include "cpu/exec/template-start.h"

#define instr add

static void do_execute() {
    int len = DATA_BYTE*8 ;//算出op_dest和op_src长度
    int s1 = op_dest->val>>(len-1);
    int s2 = op_src->val>>(len-1);//将最高位移至最低位以便判断
	DATA_TYPE result = op_src->val + op_dest->val;//无符号数加法
    update_eflags_pf_zf_sf(result);//更新eflags
    cpu.eflags.OF = (s1 == s2) && (s2 != cpu.eflags.SF);//SF与运算结果最高位相同
    cpu.eflags.CF = (result < op_dest->val);//溢出则置为1
    OPERAND_W(op_dest, result);//结果存至目的操作数
    print_asm_template2();
}

#if DATA_BYTE == 2 || DATA_BYTE == 4
make_instr_helper(si2rm)
#endif

make_instr_helper(i2a)
make_instr_helper(i2rm)
make_instr_helper(r2rm)
make_instr_helper(rm2r)


#include "cpu/exec/template-end.h"